package com.nhh.v.enums;

import lombok.Getter;

/**
 * User: Allen.qin
 * Date: 2018/9/4
 */
public enum HashRateSource {
    REG("reg", "注册"), GAME("game", "游戏"), INVITE("invite", "邀请"), PUBNUM("pubnum", "关注"),
    BINDPHONE("bindphone", "绑手机"), CUSTSER("custser", "加客服");

    @Getter
    private String code;
    @Getter
    private String value;

    HashRateSource(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public static HashRateSource of(String code) {
        for (HashRateSource r : HashRateSource.values()) {
            if (r.code.equals(code)) {
                return r;
            }
        }
        throw new IllegalArgumentException("Invalid enums:" + code);
    }

}